package com.yc.ssm.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.yc.ssm.bean.AdminInfo;
import com.yc.ssm.biz.IAdminInfoBiz;
import com.yc.ssm.util.ConstantInfo;
import com.yc.ssm.vo.ResultVO;

@RestController
@RequestMapping("/admin")
public class AdminInfoController {
	@Autowired
	private IAdminInfoBiz adminInfobiz;
	
	@PostMapping("/login")
	public ResultVO login(AdminInfo af,HttpSession session) {
		AdminInfo admin = adminInfobiz.login(af);
		if(admin != null) {
			session.setAttribute(ConstantInfo.CURRENTLOGINADMIN, admin);
			return new ResultVO(200,"成功");
		}
		return new ResultVO(500,"失败");
		
	}
}
